import javax.swing.JFrame;

import fr.lri.swingstates.canvas.CPolyLine;
import fr.lri.swingstates.canvas.Canvas;
import fr.lri.swingstates.gestures.AbstractClassifier;
import fr.lri.swingstates.gestures.rubine.RubineClassifier;

class MainFrame
{
	static Canvas canvas;
	
	public static void recognizedGestures(AbstractClassifier classifier) {
		for(int i = 0; i < classifier.getClassesNames().size(); i++) {
			CPolyLine gest = classifier.getRepresentative(classifier.getClassesNames().get(i));
			gest.addTo(canvas).scaleBy(25 / gest.getHeight(), 25 / gest.getWidth()).translateTo(75 + 50*i, 25);
			canvas.newText(0, 0, classifier.getClassesNames().get(i)).translateTo(gest.getCenterX(), gest.getMaxY() + 12);			
		}
	}
	
	static public void main(String[] args)
	{
		 JFrame frame = new JFrame() ;
		 frame.setSize(400, 400);
		 canvas = new Canvas(400,400);
		RubineClassifier classifier = null;
		classifier = RubineClassifier.newClassifier("gestures.cl");
		
		recognizedGestures(classifier);
		Recognizer sm = new Recognizer(classifier, canvas);
		sm.attachTo(canvas);
		frame.add(canvas);
		frame.setVisible(true) ;
	}
}
